package com.gf.framework.translatordemo.translator;

import com.gf.framework.common.utils.ObjectMapper;
import com.gf.framework.translatordemo.service.StudentService;
import com.gf.framework.translatordemo.vo.StudentVo;
import com.gf.framework.web.translate.Translatable;
import com.gf.framework.web.annotation.Translator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author gaofei
 * @Description
 * @create 2022/5/26 13:04
 */
@Component
public class TeacherStudentTranslator implements Translatable<Integer, List<StudentVo>> {
    @Autowired
    StudentService studentService;


    @Translator
    @Override
    public List<StudentVo> translate(Integer original, Class<?> datasource, String param) {
        return ObjectMapper.mapAsList(studentService.queryByTeacherId(original), StudentVo.class);
    }
}
